<%@page import="study.itwill.team5.board.BoardCategoryItem"%>
<%@page import="java.util.ArrayList"%>
<%@page import="study.itwill.team5.board.BoardCategory"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>

<%@include file="../dbcon.jsp"%>
<%
	BoardCategory boca = new BoardCategory();
	ArrayList<BoardCategoryItem> boca_list = boca.listBoardCategory();
	
	
%>
<!DOCTYPE html>
<html lang="ko">
<head>
<%@include file="../head.jsp"%>

</head>

<body>
	<%@include file="../menu.jsp"%>
	<%DBHandler.disconnect();%>
	<!-- 메뉴바 -->
	<div class="container">
		<div class="page-header">
			<h1>신규 카테고리 추가</h1>
		</div>
		<p>새로운 카테고리를 추가하세요.</p>
		<hr />

		<form id="frmBoardCategorytAdd" class="form-horizontal" role="form"
			method="post" action="addBoardCategoryOk.jsp">
			<fieldset>

				<!--입력양식 -->
				<div class="form-group">
					<label for="category_name" class="col-md-2 control-label">카테고리네임</label>
					<div class="col-md-10">
						<input type="text" class="form-control" id="category_name"
							placeholder="이름을 선택하세요." name="category_name">
					</div>
				</div>
				<div class="form-group">
					<div class="col-md-offset-2 col-md-10">
						<div class="row">
							<div class="col-md-6">
								<button type="submit" class="btn btn-primary btn-block">저장하기</button>
							</div>
							<div class="col-md-6">
								<button type="reset" class="btn btn-warning btn-block">다시작성</button>
							</div>
						</div>
					</div>
				</div>

			</fieldset>

		</form>

	</div>

	<!-- Javascript -->
	<script src="/italia/assets/js/jquery.js"></script>
	<script src="/italia/assets/js/bootstrap.min.js"></script>
	<!-- 형식검사 클레스 참조 -->
	<script src="/italia/assets/js/string.js"></script>
	<!-- 구현부분 -->
	<script type="text/javascript">
		// jquery main()
		$(function() {
			// id속성이 frmStudenAdd인 대상에 대한 전송 이벤트
			$("#frmBoardCategoryAdd").submit(function() {
				/** 
				 * string.js 사용 방법
				 * var str = "가나다";
				 * if(!str.isEmail()){
				 *	... 이메일 형식이 아님 ...
				 *}
				 */
				var dname = $("input[name='category_name']").val();
				// 입력여부 검사
				if (!dname.isValue()) {
					alert("이름을 선택하세요.");
					$("input[name='category_name']").focus();
					return false;
				}
				

			});

		});
	</script>
</body>
</html>






